<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="../../js/jQuery/jquery-1.8.3.min.js"></script>
    <script src="../../js/jQuery/jquery.form.js"></script>
    <script type="text/javascript">
       function BomStandard() {
           var m_id = request("wmlm_id");
           var type = "IDCard";
           var type1 = "contract";
           $("#WmlmNameId").val(m_id);
           if($("#fileName").val() == '' &&  $("#fileNames").val() == ''){
               top.isc.showMessage("请选择上传图片",top.isc.OBMessageBar.TYPE_ERROR);
               return;
           }
           var options = {
                url: top.OB.Application.contextUrl+"./org.openbravo.client.kernel?_action=com.mes.handler.BomImportPhotoHandler&WmlmNameId="+m_id,
                type: 'POST',
                dataType:'json',
                data:{type : type},
                async: false,
                success: function(data){
                    if(data.result){
                    	   top.OB.Emes_ActionButton.MyRefresh();
                        top.isc.showMessage(data.desc,top.isc.OBMessageBar.TYPE_SUCCESS);
                        top.OB.Layout.ClassicOBCompatibility.Popup.close("EMPLOYEE");
                    }else{
                        top.isc.showMessage(data.desc,top.isc.OBMessageBar.TYPE_ERROR);
                        top.OB.Layout.ClassicOBCompatibility.Popup.close("EMPLOYEE");
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    top.isc.showMessage("上传失败",top.isc.OBMessageBar.TYPE_ERROR);
                }
            };
            $("#importFile").ajaxSubmit(options);
            
       }
       
       
       function request(name) {
           var url = window.location.href;
           var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
           var url_paraObj = {}
           for (var i = 0; i < paraString.length; i++) {
               var index = paraString[i].indexOf("=");
               try {
                   url_paraObj[paraString[i].substring(0, index)] = decodeURI(paraString[i].substring(index + 1));
               } catch (e) {
                   url_paraObj[paraString[i].substring(0, index)] = paraString[i].substring(index + 1);
               }
           }
           return url_paraObj[name];
       }
    </script>
</head>
<body>
    <form name="importFile" id="importFile" method="post" enctype="multipart/form-data" align="center">
	     <input type="hidden" name="WmlmNameId" id="WmlmNameId" value="" />
	    <table cellpadding="5" cellspacing="5">
	    	<tr>
	        	<td align="right" style="width: 180px">图&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;案：</td>
	        	<td style="width: 200px;"><input type="file" name="fileName" id="fileName" /></td>
	        </tr>
	        <tr>
	        	<td align="right">工艺数据文件：</td>
	        	<td><input type="file" name="cards" id="cards" /></td>
	        </tr>

	        <tr>
	         	<td colspan="2"><input type="button" value="上传" style="height: 30px;width: 80px;background-color: #4d7607;color: #fff;" onclick="BomStandard()"/></td>
	        </tr>
	     </table>
    </form>
       
</body>
</html> 
